#define _CRT_SECURE_NO_WARNINGS 
#include <iostream>
using namespace std;

const int N = 5000 + 10;

int e[N];
int pre[N];
int id;

int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> e[i]; 
		pre[i] = i - 1;
	}
	pre[1] = n;
	int te = 1;
	while (m--) {
		for (int i = 1; i <= e[te]; i++) {
			te = pre[te];
		}
	}
	cout << te << endl;

	return 0;
}